﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="InStoreDataMeasures_MeasuresGroup_List" CodeFile="MeasuresGroup_List.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>指标组列表 </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: '指标组维护',
                closed: true,
                buttons: [{
                    text: '保存',
                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '返回',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            }); dlg.parent().appendTo(jQuery("form:first"));
        });
        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                <table id="wsd_inputtable">
                    <tr>
                        <td class="tabletitle" colspan="8">
                            指标管理
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;&nbsp;&nbsp; 指标组列表&nbsp;&nbsp;
                            <asp:DropDownList ID="ddlValid" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlValid_SelectedIndexChanged">
                                <asp:ListItem Value="">--全部--</asp:ListItem>
                                <asp:ListItem Selected="True" Value="1">--有效--</asp:ListItem>
                                <asp:ListItem Value="0">--无效--</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table><br />
                <table id="wsd_listtable" width="100%">
                    <tr>
                        <td style="width: 100%">
                            <asp:GridView Width="100%" ID="GridView1" runat="server" AutoGenerateColumns="False"
                                EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                                OnRowDataBound="Grid_RowDataBound" EnableEmptyContentRender="true" DataKeyNames="ID"
                                AllowPaging="True" BorderWidth="0" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="12" EnableModelValidation="True">
                                <HeaderStyle CssClass="titlist" />
                                <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="指标代码" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClientClick="open1()"
                                                CommandName="Select" Text='<%# Eval("CODE") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="指标组名" ShowHeader="False" ItemStyle-Width="30%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" OnClientClick="open1()"
                                                CommandName="Select" Text='<%# Eval("NAME") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="备注" ItemStyle-Width="40%" ItemStyle-HorizontalAlign="center"
                                        HeaderStyle-HorizontalAlign="center" ShowHeader="False">
                                        <ItemTemplate>
                                            <%# Eval("Remark") %>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="有效">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%>
                                            </b>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="操作">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton3" runat="server" PostBackUrl='<%#"MeasuresGroup_Item_List.aspx?MGID="+Eval("ID") %>'
                                                CausesValidation="false" Text='维护指标项'>
                                            </asp:LinkButton>
                                            <asp:LinkButton ID="LinkButton4" runat="server" PostBackUrl='<%#"MeasuresGroup_SelectCustomer.aspx?MGID="+Eval("ID") %>'
                                                CausesValidation="false" Text='分配客户'>
                                            </asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle CssClass="evenline" />
                                <AlternatingRowStyle CssClass="oddline" />
                                <PagerSettings FirstPageText="首页" LastPageText="尾页" PageButtonCount="30" Visible="false" />
                            </asp:GridView>
                            <uc1:GridPager ID="GridPager1" runat="server" Visible="false" />
                        </td>
                    </tr>
                </table>
                <br />
                <table id="wsd_inputtable">
                    <tr>
                        <td width="100%" class="tabletitle">
                            操作选项
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <asp:Button ID="btnAdd" runat="server" CausesValidation="false" class="wsd_button2"
                                Text="新  增" OnClick="btnAdd_Click" OnClientClick="open1()" />
                        </td>
                    </tr>
                </table>
            </div>
            </div> </div> </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            <%--<asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />--%>
        </Triggers>
    </asp:UpdatePanel>
    <div id="dd" style="width: 350px; height: 250px;">
        <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <table id="Table2" style="width: 100%; text-align: center;">
                    <tr>
                        <td class="tabletitle" style="width: 100%; text-align: left;">
                            <font color="red" size="2"><b>提示:*为必填项</b></font>
                        </td>
                        <td class="tabletitle">
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable" style="width: 100%; border: 0px;">
                    <tr>
                        <td>
                            <center>
                                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
                                    DefaultMode="Insert" OnDataBound="DetailsView1_DataBound" BorderWidth="0px" EnableModelValidation="True"
                                    GridLines="None">
                                    <PagerStyle HorizontalAlign="Right"></PagerStyle>
                                    <Fields>
                                        <asp:TemplateField HeaderText="代码:<font color=red>*</font>">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtCode" runat="server" Text='<%# Bind("CODE") %>'></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                                                    ErrorMessage="代码不能为空" ControlToValidate="txtCode"></asp:RequiredFieldValidator><br />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="组名:<font color=red>*</font>">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("NAME") %>'></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                                                    ErrorMessage="组名不能为空" ControlToValidate="txtName"></asp:RequiredFieldValidator><br />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="备注:">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtRemark" TextMode="MultiLine" runat="server" Text='<%# Bind("REMARK") %>'></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="有效:">
                                            <ItemTemplate>
                                                <asp:CheckBox runat="server" ID="chkValid" Checked='<%# Bind("ACTIVE") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Fields>
                                    <RowStyle CssClass="tablefield" />
                                </asp:DetailsView>
                                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.MEASUER_GROUP"
                                    DeleteMethod="Save" InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.InStoreDataMeasures.MeasuresGroupManager"
                                    UpdateMethod="Save">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                            Type="Int32" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                            </center>
                        </td>
                    </tr>
                </table>
                <div style="display: none;">
                    <table id="Table1" style="width: 100%">
                        <tr>
                            <td height="10px" width="100%" class="tabletitle">
                                操作选项
                            </td>
                        </tr>
                        <tr>
                            <td class="buttonarea">
                                <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />&nbsp;&nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
